package com.rock.code.base.domain;

import com.alibaba.fastjson.JSONObject;

import java.util.Map;

/**
 * TODO
 *
 * @author kongqiang
 * @date 17/3/23
 */
public class AjaxJson {

    private boolean success = true;// 是否成功
    private String msg = "操作成功";// 提示信息
    private Object result;// 结果信息
    private Map<String, Object> attributes;// 其他参数

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    public Map<String, Object> getAttributes() {
        return attributes;
    }

    public void setAttributes(Map<String, Object> attributes) {
        this.attributes = attributes;
    }

    public String getJsonStr(){
        JSONObject obj = new JSONObject();
        obj.put("success", this.isSuccess());
        obj.put("msg", this.getMsg());
        obj.put("result", this.result);
        obj.put("attributes", this.attributes);
        return obj.toJSONString();
    }
}
